package cn.edu.scau.cmi.guihao.pane;

import java.io.IOException;
import java.net.URL;
import java.util.ArrayList;
import java.util.List;
import java.util.Observable;
import java.util.ResourceBundle;

import cn.edu.scau.cmi.guihao.abstractFactory.InsuranceFactory;
import cn.edu.scau.cmi.guihao.domin.fitComponent.Person;
import cn.edu.scau.cmi.guihao.domin.fitComponent.SmallOrganization;
import cn.edu.scau.cmi.guihao.interProgramming.abstractFactory.Insurance;
import cn.edu.scau.cmi.guihao.interProgramming.abstractFactory.InsuranceCompany;
import javafx.collections.FXCollections;
import javafx.collections.ObservableList;
import javafx.fxml.FXML;
import javafx.fxml.FXMLLoader;
import javafx.fxml.Initializable;
import javafx.scene.control.ComboBox;
import javafx.scene.control.TextArea;
import javafx.scene.image.Image;
import javafx.scene.image.ImageView;
import javafx.scene.layout.Pane;
import javafx.scene.text.Text;

public class FitComponentPane extends Pane implements Initializable{

	@FXML
	private TextArea displayMessage;

	SmallOrganization rootBranch;
	
	
	@FXML
	public void onBtnClick() {
		displayMessage.setText(rootBranch.display());
	}
	
	public FitComponentPane() {
		FXMLLoader loader = new FXMLLoader(getClass().getResource("/cn/edu/scau/cmi/guihao/view/FitComponentView.fxml"));
        loader.setRoot(this);
        loader.setController(this);
        try {
            loader.load();
        } catch (IOException e) {
            e.printStackTrace();
        }
	}

	@Override
	public void initialize(URL location, ResourceBundle resources) {
		// TODO Auto-generated method stub
		rootBranch = new SmallOrganization("root");
		SmallOrganization a1 = new SmallOrganization("组织1");
		rootBranch.addOrganization(a1);
		SmallOrganization a2 = new SmallOrganization("组织2");
		rootBranch.addOrganization(a2);
		Person a11 = new Person("人员1");
		a1.addOrganization(a11);
		Person a12 = new Person("人员2");
		a1.addOrganization(a12);
	}

	
	
}
